<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<jsp:useBean id="today" class="java.util.Date" />


<c:import url="/view/admin/include/header/adminHeader.jsp"></c:import>
    <!-- 컨텐츠 부분 -->
	<div id="container">
    	<!-- 왼쪽 메뉴 부분 -->
    	<c:import url="/view/admin/include/left/adminLeft.jsp"></c:import>
        <!-- 왼쪽 메뉴 부분 -->
        <!-- 오른쪽 내용 부분 -->
        
         <dl>
        	<dd class="path">
        	홈 > 게시판 관리 > 
        		<span class="path_b">
        			소송진행 현황
        		</span>
        	</dd>
        </dl>
        <dl class="content">
            <dd class="summary">
            <ul class="tab qna_box">
	           <li class="on">기본정보</li>
		       <li class="off">제1심</li>
		       <li class="off">제2심</li>
		       <li class="off">대법원</li>
	        </ul>
	            <dl>
       <span class="left f_orange">※ 진행 중이거나 완료된 소송기록을 확인하실 수 있습니다.</span>
           <p class="align_r">
        	<span class="f_red" style="right">*</span> 는 필수입력항목입니다.</p>
        </dl>
            	<form id="modiFrm" name="modiFrm" action="/admin/casemodiFrm.hcom" method="post" enctype="multipart/form-data">
            	<input type="hidden" name="mem_no"	value="<s:property value="#session.id" />"> 
            	<input type="hidden" name="writer" value="<s:property value="#session.name" />"> 
            	<input type="hidden" id="save_type" name="save_type" value="case" />
            	<input type="hidden" id=case_seq name="case_seq" value="${boardView.case_seq }" />
            	<table cellspacing="0" cellpadding="0" summary="" >
                	<caption></caption>
                    	 <colgroup>
                          <col width="15%;"/>
                          <col width="45%;"/>
                          <col width="10%;"/>
                          <col width="30%"/>
                         </colgroup>
                    <tbody>
                    	<tr>
                        	<th scope="row" class="table_txt_left"><span class="f_red">*</span>작성자</th>
                            <td class="table_txt_left f_blue"><s:property value="#session.name" />
                            <th scope="row" class="table_txt_left">프로젝트</th>
                            <td class="table_txt_left"><input id="order_no" name="order_no" type="text" value="${boardView.order_no }" style="width:100px;" maxlength="10"/></td>
                        </tr>
                    	<tr>
                        	<th scope="row" class="table_txt_left"><span class="f_red">*</span>사건명</th>
                            <td class="table_txt_left f_blue"><input id="case_name" name="case_name" type="text" value="${boardView.case_name }" style="width:200px;"/></td>
                            <th scope="row" class="table_txt_left"><span class="f_red">*</span>공개여부</th>
                            <td class="table_txt_left">
                          	    <input type="radio" name="open_flag" value="Y" <c:if test="${boardView.open_flag == 'Y'}">checked</c:if>/>공개&nbsp;&nbsp;
	      						<input type="radio" name="open_flag" value="N" <c:if test="${boardView.open_flag == 'N' || boardView.open_flag == NULL}">checked</c:if>/>비공개&nbsp;
                            					</td> 
	                    </tr>
                        <tr>
                        	<th scope="row" class="table_txt_left"><span class="f_red">*</span>부서명</th>
                        	<td class="table_txt_left">
                          		<select id="mem_dept" name="mem_dept">
			            			<option value="EL31">경리부</option>
									<option value="EL28">경영지원부</option>
									<option value="EL17">고객지원1부</option>
									<option value="EL18">고객지원2부</option>
									<option value="EL22">구매부</option>
									<option value="EL26">기계개발부</option>
									<option value="EL05">기술영업부</option>
									<option value="EL33">기획관리부</option>
									<option value="EL47">나웅산전</option>
									<option value="EL19">리모델링영업부</option>
									<option value="EL34">마케팅부</option>
									<option value="EL40">미래ESP</option>
									<option value="EL38">브라질법인</option>
									<option value="EL42">상성산업</option>
									<option value="EL39">상해법인</option>
									<option value="EL21">생산부</option>
									<option value="EL15">서비스관리부</option>
									<option value="EL16">서비스마케팅부</option>
									<option value="EL45">서진E/L</option>
									<option value="EL20">설계부</option>
									<option value="EL06">설치1부</option>
									<option value="EL07">설치2부</option>
									<option value="EL08">설치관리부</option>
									<option value="EL41">수영엘텍</option>
									<option value="EL48">신라산업</option>
									<option value="EL43">신성산기</option>
									<option value="EL49">알앤엠</option>
									<option value="EL02">영업1부</option>
									<option value="EL03">영업2부</option>
									<option value="EL04">영업3부</option>
									<option value="EL37">윤리경영부</option>
									<option value="EL44">이존산업</option>
									<option value="EL27">인재개발부</option>
									<option value="EL30">재정부</option>
									<option value="EL23">제조지원부</option>
									<option value="EL25">전기제어부</option>
									<option value="EL29">준법지원부</option>
									<option value="EL56">강원지사</option>
									<option value="EL60">경기지사</option>
									<option value="EL58">경남지사</option>
									<option value="EL53">광주지사</option>
									<option value="EL52">대구지사</option>
									<option value="EL54">대전지사</option>
									<option value="EL51">부산지사</option>
									<option value="EL57">울산지사</option>
									<option value="EL59">인천지사</option>
									<option value="EL55">전주지사</option>
									<option value="EL61">제주지사</option>
									<option value="EL50">토탈세일즈</option>
									<option value="EL35">품질관리부</option>
									<option value="EL32">해외법인관리부</option>
									<option value="EL13">해외영업 1부</option>
									<option value="EL14">해외영업 2부</option>
									<option value="EL36">효율개선부</option>
									<option value="EL46">E&P</option>
									<option value="EL24">IT응용기술부</option>
									<option value="EL09">MP설치부</option>
									<option value="EL11">S/S 개발</option>
									<option value="EL12">S/S 설치</option>
									<option value="EL10">S/S 영업</option>
	            				</select>
                       		</td> 
                            <th scope="row" class="table_txt_left"><span class="f_red">*</span>소가</th>
                            <td class="table_txt_left"><input id="sue_money" name="sue_money" type="text" value="${boardView.sue_money}" style="width:150px;" maxlength="15" onkeyup="number_check2(sue_money)"/>단위 :원</td>
                        </tr>
                        <tr>
                        	<th scope="row" class="table_txt_left"><span class="f_red">*</span>원고</th>
                            <td class="table_txt_left"><input id="plaintiff" name="plaintiff" type="text" value="${boardView.plaintiff }" style="width:200px;"/></td>
                            <th scope="row" class="table_txt_left"><span class="f_red">*</span>피고</th>
                            <td class="table_txt_left"><input id="defendant" name="defendant" type="text" value="${boardView.defendant }" style="width:200px;"/></td>
                        </tr>
                        <tr>
                        	<th scope="row" class="table_txt_left"><span class="f_red">*</span>제(피)소</th>
                            <td class="table_txt_left">
	                            <input type="radio" name="sue_flag" value="1" <c:if test="${boardView.sue_flag == '1'}">checked</c:if>/>제소&nbsp;&nbsp;
	      						<input type="radio" name="sue_flag" value="0" <c:if test="${boardView.sue_flag == '0' || boardView.sue_flag == NULL}">checked</c:if>/>피소&nbsp;
                           							   </td>
                            <th scope="row" class="table_txt_left"><span class="f_red">*</span>상태</th>
                            <td class="table_txt_left">
                            	<input type="radio" name="status_flag" value="P" <c:if test="${boardView.status_flag == 'P'}">checked</c:if>/>진행&nbsp;&nbsp;
	      						<input type="radio" name="status_flag" value="D" <c:if test="${boardView.status_flag == 'D' || boardView.status_flag == NULL}">checked</c:if>/>완료&nbsp;
                            					</td> 
                        </tr>
                        <tr>
                        	<th scope="row" class="table_txt_left">기타</th>
                            <td class="table_txt_left" colspan="4"><input id="etc" name="etc" type="text" value="${boardView.etc }" style="width:630px;" maxlength="20"/></td>
                        </tr>
                       <tr>
	                       <td class="table_txt_left table_td_bottom_x padding5">
	                        		<span class="f_black b"><span class="f_red">*</span>사건개요</span>
	                       </td>
	                       	    <td class="table_td_bottom_x padding5"></td>
	                            <td class="table_td_bottom_x padding5"></td>
	                        </tr>
	                        <tr>
	                        	<td class="table_txt_left table_td_bottom_comment" colspan="4"><textarea id="summary" name="summary" style="width:99%; height:100px;">${boardView.summary }</textarea></td>	                        	
	                        </tr>  
                    </tbody>
                 </table>
               </form>
            </dd>
            <dd class="btn_right">
            	<input type="button" id="btnUpdate" value="수정" class="input_btn_s b" />
            	<input type="button" id="btnList" value="목록" class="input_btn_s b" />
            </dd>
        </dl>
        <!-- 오른쪽 내용 부분 -->
    </div>
    <!-- 컨텐츠 부분 -->
<c:import url="/view/admin/include/footer/adminFooter.jsp"></c:import>
<script type="text/javascript" src="/js/portal/board.js"></script>
<script type="text/javascript">
$().ready(function(){		
	$("#btnUpdate").click(function(){
		oEditors[0].exec("UPDATE_CONTENTS_FIELD", []);
		if(validateCheck()){
			if(confirm("수정하시겠습니까?")){
				$("#modiFrm").submit();
			}		
		}
	});
	
	$("#btnList").click(function(){
		location.href="/admin/caseList.hcom?";
	});
	
	var str = $("#sue_money").val();
	 str = str.replace(/,/gi,"");
	// alert(str);
	 $("#sue_money").val(str);
	
	var mem_dept = '<%=request.getParameter("mem_dept") %>';
	/* alert(mem_dept); */
	if(mem_dept != ''){
		$("#mem_dept").val(mem_dept);
	};
		
});

var oEditors = [];
// 에디터 생성
nhn.husky.EZCreator.createInIFrame({
	oAppRef: oEditors,
	elPlaceHolder: "summary",
	sSkinURI: "/sEditor/SmartEditor2Skin.html",
	fCreator: "createSEditor2",		
});	

function pasteHTMLDemo(){
	sHTML = "<span style='color:#FF0000'>이미지 등도 이렇게 삽입하면 됩니다.</span>";
	oEditors.getById["summary"].exec("PASTE_HTML", [sHTML]);
}

function showHTML(){
	alert(oEditors.getById["summary"].getIR());
}

/* function number_check2(order_no)
{
     var num = "0123456789";
     var check = 0;
     var str = order_no.value;
     var len = order_no.value.length;

     for(var i=0; i<len; i++)   if(num.indexOf(str.substring(i,i+1)) >= 0)  check++
     if(check != len){
            alert('숫자만 입력이 가능합니다');
            order_no.value='';
     }
}
 */

function number_check2(sue_money)
{
     var num = "0123456789";
     var check = 0;
     var str = sue_money.value;
     var len = sue_money.value.length;

     for(var i=0; i<len; i++)   if(num.indexOf(str.substring(i,i+1)) >= 0)  check++
     if(check != len){
            alert('숫자만 입력이 가능합니다');
            sue_money.value='';
     }
}

function validateCheck(){	
	
	if($("#case_name").val() == ''){
		alert('사건명을 입력해주십시요');
		$("#case_name").focus();
		return false;
	}
	if($("#open_flag").val() == ''){
		alert('공개여부를 선택해주십시요');
		$("#open_flag").focus();
		return false;
	}
	if($("#sue_money").val() == ''){
		alert('금액을 입력해주십시요');
		$("#sue_money").focus();
		return false;
	}
	if($("#plaintiff").val() == ''){
		alert('원고를 입력해주십시요');
		$("#plaintiff").focus();
		return false;
	}
	if($("#defendant").val() == ''){
		alert('피고를 입력해주십시요');
		$("#defendant").focus();
		return false;
	}
	if($("#sue_flag").val() == ''){
		alert('항목을 선택해주십시요');
		$("#sue_flag").focus();
		return false;
	}
	if($("#status_flag").val() == ''){
		alert('항목을 선택해주십시요');
		$("#status_flag").focus();
		return false;
	}
	if($("#summary").val() == ''){
		alert('내용을입력해주십시요');
		return false;
	}	
	return true;
} 
</script>